#pragma once
#include <assert.h>
namespace lw
{
	template<size_t N>
	class bitset
	{
	public:
		bitset()
		{
			_bits.resize(N / 32 + 1);
		}
		void set(size_t pos)
		{
			assert(pos <= N);
			size_t i = pos / 32;
			size_t j = pos % 32;

			_bits[i] |= (1 << j);
		}
		void reset(size_t pos)
		{
			assert(pos <= N);
			size_t i = pos / 32;
			size_t j = pos % 32;
	
			_bits[i] &= ~(1 << j);
		}
		bool test(size_t pos)
		{
			assert(pos <= N);
			size_t i = pos / 32;
			size_t j = pos % 32;

			return _bits[i] & (1 << j);
		}
	private:
		vector<int> _bits;
	};
}
